<template lang="html">
  <div>
    <input type="text" v-model="num">
    {{num | parseChinese}}
  </div>
</template>

<script>
export default {
  data () {
    return {
      num: 0,
      chineseNum: "",
      chineseSymbol: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
      chineseSection: ["", "万", "亿", "万亿"],
      chineseUnit: ["", "十", "百", "千"],
      chineseUnitArab: {
        "零": 0,
        "一": 1,
        "二": 2,
        "三": 3,
        "四": 4,
        "五": 5,
        "六": 6,
        "七": 7,
        "八": 8,
        "九": 9,
        "十": 10,
        "百": 100,
        "千": 1000,
        "万": 10000,
        "亿": 100000000,
        "万亿": 1000000000000
      }
    }
  },
  created () {

  },
  methods: {

  },
  filters: {
    parseChinese (num) {
      num = num >> 0
      const NUMBER = ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"]
      const UNIT = ["", "十", "百", "千", "万", "十", "百"]

      let result = []
      while (num / 10 > 0 && UNIT.length) {
        result.push(NUMBER[num % 10] + UNIT.shift())
        num = num / 10 >> 0
      }
      return result.reverse().join('')
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
